<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ .title }}</title>
    <!-- GridStack CSS -->
    <link href="https://cdn.jsdelivr.net/npm/gridstack@7.2.3/dist/gridstack.min.css" rel="stylesheet"/>
    <!-- 自定义样式 -->
    <link href="/static/css/style.css" rel="stylesheet">
</head>
<body>
    <div class="container">
        <h1>可拖拽仪表板 <small>ID: {{ .id }}</small></h1>
        <div class="controls">
            <select id="widget-type">
                <option value="">选择部件类型</option>
                <option value="text">文本</option>
                <option value="button">按钮</option>
                <option value="switch">开关</option>
                <option value="image">图片</option>
                <option value="chart">图表</option>
            </select>
            <button id="add-widget">添加部件</button>
            <button id="remove-selected">删除选中部件</button>
            <button id="save-btn">保存布局</button>
            <button id="new-dashboard">新建仪表板</button>
        </div>
        <div class="grid-stack"></div>
    </div>

    <!-- jQuery (GridStack依赖) -->
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/gridstack@7.2.3/dist/gridstack-all.js"></script>
    <!-- 自定义JS -->
    <script src="/static/js/app.js"></script>
    <script>
        // 传递ID到前端
        const dashboardId = "{{ .id }}";
    </script>
</body>
</html>